#ifndef __RenderToVertexBuffer_H__
#define __RenderToVertexBuffer_H__

#include "Material.h"
#include "RenderOperation.h"

namespace PVM
{
	class RenderToVertexBuffer
	{
	public:
		RenderToVertexBuffer();
		virtual ~RenderToVertexBuffer();
		
		VertexDeclaration* getVertexDeclaration();
		
		unsigned int getMaxVertexCount() const {return mMaxVertexCount;}
		
		void setMaxVertexCount(unsigned int maxVertexCount) {mMaxVertexCount = maxVertexCount;}
		
		RenderOperation::OperationType getOperationType() const {return mOperationType;}
		
		void setOperationType(RenderOperation::OperationType operationType) {mOperationType = operationType;}
		
		void setResetsEveryUpdate(bool resetsEveryUpdate) {mResetsEveryUpdate = resetsEveryUpdate;}
		
		bool getResetsEveryUpdate() const {return mResetsEveryUpdate;}
		
		virtual void getRenderOperation(RenderOperation& op) = 0;
		
		virtual void update(SceneManager* sceneMgr) = 0;
		
		virtual void reset(mResetRequested = true;)
		
		void setSourceRenderable(Renderable* source) {mSourceRenderable = source;}
		
		const Renderable* getSourceRenderable() const {return mSourceRenderable;}
		
		const MaterialPtr& getRenderToBufferMaterial() {return mMaterial;}
		
		void setRenderToBufferMaterialName(const std::string& materialName);
		
	protected:
		RenderOperation::OperationType mOperationType;
		bool mResetsEveryUpdate;
		bool mResetRequested;
		MaterialPtr mMaterial;
		Renderable* mSourceRenderable;
		VertexData* mVertexData;
		unsigned int mMaxVertexCount;
	};
	
	typedef SharedPtr<RenderToVertexBuffer> RenderToVertexBufferSharedPtr;
}

#endif
